<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width,initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta http-equiv=X-UA-Compatible content="IE=edge,chrome=1">
    <meta content=always name=referrer>
    <link rel="stylesheet" type="text/css" href="__STATIC__/css/newbase.css">
    <script src="__STATIC__/js/jquery-1.8.2.js"></script>
    <title>赚取积分</title>
</head>
<body>
<div class="wrap-earn">
    <div class="header">
        <p>赚取积分</p>
        <img src="__STATIC__/img/back.png" class="back" onclick=window.location.href="{:url('mobile/user_info/integral_index')}">
    </div>
    <div class="center">
        <img src="__STATIC__/img_user/zq-jifenbeijing.png">
        {if condition="$sign eq ''"}
        <div class="title"><a href="javascript:signing();">立即签到</a></div>
        {else/}
        <div class="title"><a>已签到</a></div>
        {/if}
    </div>
    <div class="content" style="padding-bottom: 2%;">
        <div><p>做任务送积分</p></div>
    </div>
    <ul class="list">
        {volist name="data" id="vo"}
        <li style="overflow: hidden;">
            <div style="float: left;">{$vo.varinfo}:</div>
            <div  style="float: right;">+{$vo.varvalue}</div>
        </li>
        {/volist}
    </ul>
</div>
</body>
<script>
    function signing() {
        $.ajax({
            url:"{:url('user_port/sign_in')}",
            type:'post',
            dataType:'json',
            data:{'act':'signing'},
            success:function (t) {
                console.log(t);
                if (t.code == 200){
                    //签到成功
                    layer.open({content:t.message,skin:'msg',time:2});

                    setTimeout(function () {
                        location.reload();
                    }, 2000);

                }else if (t.code == 404){
                    //非会员进行签到
                    layer.open({
                        content: '您还未登录'
                        ,btn: ['去登录', '取消']
                        ,yes: function(index){
                            window.location.href="{:url('mobile/user_port/login')}";
                            layer.close(index);
                        }
                    });
                }else{
                    layer.open({content:t.message,skin:'msg',time:2})
                }
            },
            error: function () {
                layer.open({content:'网络繁忙,请重试',skin:'msg',time:2});
            }
        })
    }
</script>
{include file="public/src" /}
</html>